package edu.ncsu.contractminer.event;

import java.util.LinkedList;
import java.util.List;

public class StringToNumericForWeka {

	private static List<String> modalVerbList = new LinkedList<String>();
	private static List<String> clauseSignalList = new LinkedList<String>();

	private static void initialize() {// should | shall | will | would | may |
		// might | must | can | could |
		// agrees to | agree to | represents | represent | warrants | warrant |
		// reponsible for | obligated to | liable for
		modalVerbList.add("should");
		modalVerbList.add("shall");
		modalVerbList.add("will");
		modalVerbList.add("would");
		modalVerbList.add("may");
		modalVerbList.add("might");
		modalVerbList.add("must");
		modalVerbList.add("can");
		modalVerbList.add("could");

		clauseSignalList.add("after");
		clauseSignalList.add("although");
		clauseSignalList.add("as");
		clauseSignalList.add("because");
		clauseSignalList.add("before");
		clauseSignalList.add("even");
		clauseSignalList.add("except");
		clauseSignalList.add("for");
		clauseSignalList.add("how");
		clauseSignalList.add("however");
		clauseSignalList.add("if");
		clauseSignalList.add("in");
		clauseSignalList.add("once");
		clauseSignalList.add("so");
		clauseSignalList.add("than");
		clauseSignalList.add("that");
		clauseSignalList.add("so");
		clauseSignalList.add("then");
		clauseSignalList.add("though");
		clauseSignalList.add("unless");
		clauseSignalList.add("until");
		clauseSignalList.add("what");
		clauseSignalList.add("when");
		clauseSignalList.add("whenever");
		clauseSignalList.add("where");
		clauseSignalList.add("wherever");
		clauseSignalList.add("whether");
		clauseSignalList.add("which");
		clauseSignalList.add("while");
		clauseSignalList.add("whichever");
		clauseSignalList.add("while");
		clauseSignalList.add("who");
		clauseSignalList.add("whom");
		clauseSignalList.add("why");

	}

	public static int getModalVerNominalSize() {
		if (modalVerbList.isEmpty())
			initialize();
		return modalVerbList.size() + 1;
	}

	public static int getClauseSignalNorminalSize() {
		if (clauseSignalList.isEmpty())
			initialize();
		return clauseSignalList.size() + 1;
	}

	public static int modalVerbStringToNumerical(String modalVerb) {
		if (modalVerbList.isEmpty())
			initialize();

		modalVerb = modalVerb.trim().toLowerCase();
		// if there is no modal verb set it to 0
		if (modalVerb.isEmpty())
			return 0;
		else {
			int total = modalVerbList.size();
			int index = modalVerbList.indexOf(modalVerb);

			// if modal verb is not in the list set it to total+1;
			if (index == -1)
				return total + 1;
			// else return the index+1;
			else
				return index + 1;
		}
	}

	public static int subClauseWordStringToNumerical(String subClauseWord) {

		if (clauseSignalList.isEmpty())
			initialize();

		subClauseWord = subClauseWord.trim().toLowerCase();
		// if there is no modal verb set it to 0
		if (subClauseWord.isEmpty())
			return 0;
		else {
			int total = clauseSignalList.size();
			int index = clauseSignalList.indexOf(subClauseWord);

			// if modal verb is not in the list set it to total+1;
			if (index == -1)
				return total + 1;
			// else return the index+1;
			else
				return index + 1;
		}
	}

	public static int booleanToInt(boolean subContainsNE) {
		if (subContainsNE)
			return 1;
		else
			return 0;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
